Revert "Avoid type checking overhead for resize-mode"
authorBenjamin Otte <otte@redhat.com>
Sat, 12 Sep 2015 19:27:10 +0000 (21:27 +0200)
committerBenjamin Otte <otte@redhat.com>
Sat, 12 Sep 2015 19:27:24 +0000 (21:27 +0200)
This reverts commit 3eacfa88f2d9c690a006de9cac1cd3c60901686c.

Apart from the patch not being correct, we don't want to expose private
structures in header files if we can avoid it.
And this type-checking overhead is not an optimization that is even
measurable.

https://bugzilla.gnome.org/show_bug.cgi?id=754932

gtk/gtkcontainer.c
gtk/gtkcontainerprivate.h
gtk/gtkcsswidgetnode.c
gtk/gtkwidget.c
gtk/gtkwindow.c

index 4bc8e84ce78db4763528edcc9e968d6c80b9dfe1..16337b59b90c19535889511df4cab9a78412c92a 100644 (file)
  *
  */
 
+
+struct _GtkContainerPrivate
+{
+  GtkWidget *focus_child;
+
+  GdkFrameClock *resize_clock;
+  guint resize_handler;
+
+  guint border_width : 16;
+  guint border_width_set   : 1;
+
+  guint has_focus_chain    : 1;
+  guint reallocate_redraws : 1;
+  guint resize_pending     : 1;
+  guint restyle_pending    : 1;
+  guint resize_mode        : 2;
+  guint request_mode       : 2;
+};
+
 enum {
   ADD,
   REMOVE,
@@ -2052,7 +2071,7 @@ gtk_container_queue_resize_handler (GtkContainer *container)
   GtkWidget *widget;
 
   G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
-  g_return_if_fail (_GTK_IS_RESIZE_CONTAINER (container));
+  g_return_if_fail (GTK_IS_RESIZE_CONTAINER (container));
   G_GNUC_END_IGNORE_DEPRECATIONS;
 
   widget = GTK_WIDGET (container);
@@ -2097,7 +2116,7 @@ _gtk_container_queue_resize_internal (GtkContainer *container,
       _gtk_size_request_cache_clear (_gtk_widget_peek_request_cache (widget));
 
       G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
-      if (_GTK_IS_RESIZE_CONTAINER (container))
+      if (((GtkContainer*)widget)->priv->resize_mode != GTK_RESIZE_PARENT)
         break;
       G_GNUC_END_IGNORE_DEPRECATIONS;
 
@@ -2185,7 +2204,7 @@ gtk_container_real_check_resize (GtkContainer *container)
       requisition.height > allocation.height)
     {
       G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
-      if (_GTK_IS_RESIZE_CONTAINER (container))
+      if (GTK_IS_RESIZE_CONTAINER (container))
         {
           gtk_widget_size_allocate (widget, &allocation);
           gtk_widget_set_allocation (widget, &allocation);
index fa524815ae5499dfa0cb45a6002e6dbe99a654d9..ec817202a9f0a3e0d5beb73989392106640c73a9 100644 (file)
 
 G_BEGIN_DECLS
 
-struct _GtkContainerPrivate
-{
-  GtkWidget *focus_child;
-
-  GdkFrameClock *resize_clock;
-  guint resize_handler;
-
-  guint border_width : 16;
-  guint border_width_set   : 1;
-
-  guint has_focus_chain    : 1;
-  guint reallocate_redraws : 1;
-  guint resize_pending     : 1;
-  guint restyle_pending    : 1;
-  guint resize_mode        : 2;
-  guint request_mode       : 2;
-};
-
 
 void     _gtk_container_queue_resize           (GtkContainer *container);
 void     _gtk_container_queue_restyle          (GtkContainer *container);
@@ -62,16 +44,6 @@ gboolean  _gtk_container_get_border_width_set   (GtkContainer *container);
 void      _gtk_container_set_border_width_set   (GtkContainer *container,
                                                  gboolean      border_width_set);
 
-static inline GtkResizeMode _gtk_container_get_resize_mode (GtkContainer *container);
-
-static inline GtkResizeMode
-_gtk_container_get_resize_mode (GtkContainer *container)
-{
-  return container->priv->resize_mode;
-}
-
-#define _GTK_IS_RESIZE_CONTAINER(container) (_gtk_container_get_resize_mode (GTK_CONTAINER (container)) != GTK_RESIZE_PARENT)
-
 G_END_DECLS
 
 #endif /* __GTK_CONTAINER_PRIVATE_H__ */
index e9d2056be43b28840bc69f2655ced4f5c954fb4c..cf68fb4e59bf3f87cd5e688d7b03d67f3f9b3d06 100644 (file)
@@ -101,7 +101,7 @@ gtk_css_widget_node_queue_validate (GtkCssNode *node)
   GtkCssWidgetNode *widget_node = GTK_CSS_WIDGET_NODE (node);
 
   G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-  if (_GTK_IS_RESIZE_CONTAINER (widget_node->widget))
+  if (GTK_IS_RESIZE_CONTAINER (widget_node->widget))
     widget_node->validate_cb_id = gtk_widget_add_tick_callback (widget_node->widget,
                                                                 gtk_css_widget_node_queue_callback,
                                                                 node,
@@ -115,7 +115,7 @@ gtk_css_widget_node_dequeue_validate (GtkCssNode *node)
   GtkCssWidgetNode *widget_node = GTK_CSS_WIDGET_NODE (node);
 
   G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-  if (_GTK_IS_RESIZE_CONTAINER (widget_node->widget))
+  if (GTK_IS_RESIZE_CONTAINER (widget_node->widget))
     gtk_widget_remove_tick_callback (widget_node->widget,
                                      widget_node->validate_cb_id);
   G_GNUC_END_IGNORE_DEPRECATIONS
index 4cb285c8549193c0dac9062e112c8818d70f31b4..4d714b2544197bb738b2ae8e3afa43ab1e154e3d 100644 (file)
@@ -17223,6 +17223,8 @@ _gtk_widget_add_controller (GtkWidget          *widget,
   EventControllerData *data;
   GtkWidgetPrivate *priv;
 
+  g_return_if_fail (GTK_IS_WIDGET (widget));
+  g_return_if_fail (GTK_IS_EVENT_CONTROLLER (controller));
   g_return_if_fail (widget == gtk_event_controller_get_widget (controller));
 
   priv = widget->priv;
index 55ad1ff8d34d80fe2f809344fdc2bc892cfb8df9..b693f943631e0f726de8e9aa2c47e4251cce7390 100644 (file)
@@ -9444,7 +9444,7 @@ gtk_window_move_resize (GtkWindow *window)
          gtk_widget_size_allocate (widget, &allocation);
 
           G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
-         if (_gtk_container_get_resize_mode (container) == GTK_RESIZE_QUEUE)
+         if (gtk_container_get_resize_mode (container) == GTK_RESIZE_QUEUE)
            gtk_widget_queue_draw (widget);
           G_GNUC_END_IGNORE_DEPRECATIONS;
        }
@@ -9471,7 +9471,7 @@ gtk_window_move_resize (GtkWindow *window)
           * we handle those ourselves upon ->configure_notify_received==TRUE.
           */
           G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
-         if (_gtk_container_get_resize_mode (container) == GTK_RESIZE_QUEUE)
+         if (gtk_container_get_resize_mode (container) == GTK_RESIZE_QUEUE)
            {
              gtk_widget_queue_resize_no_redraw (widget);
              _gtk_container_dequeue_resize_handler (container);